package com.bicon.botu.mall.base.controller;

import com.bicon.botu.core.base.common.Constants;
import com.bicon.botu.core.base.common.controller.BaseController;
import com.bicon.botu.core.base.common.entity.BaseResult;
import com.bicon.botu.mall.base.service.TranceRecommendService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * <p> 定制推荐管理
 * </p>
 *
 * @author tao.zeng.
 * @since 2018/3/15.
 */
@RestController
@RequestMapping("/V2.0.0/web/trance-recommend")
public class TranceRecommendController extends BaseController {

    @Autowired
    private TranceRecommendService tranceRecommendService;

    /**
     * 报存定制推荐
     *
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public BaseResult add(String pictureUrl) {

        if (StringUtils.isEmpty(pictureUrl)) {
            return sendResult(Constants.RESPONSE_CODE_400, "图片地址不能为空!");
        }
        boolean flag = tranceRecommendService.add(pictureUrl);
        return flag ? sendResult200() : sendResult400();
    }
}
